﻿using Grasp.Xzg.LogicApi.Products;
using Open.Domain;
using Open.Domain.Abstractions;
using SqlSugar;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Open.Product.Domain.Model
{

    [Table("baseproductstandards")]
    public class ProductStandard : AggregateRoot<ProductStandard, string>, IMustHaveTenant, IPassivable
    {
        /// <summary>
        /// 初始化应用程序
        /// </summary>
        /// <param name="id">应用程序标识</param>
        public ProductStandard(string id) : base(id)
        {

        }

        /// <summary>
        /// 初始化应用程序
        /// </summary>
        public ProductStandard() : this(string.Empty)
        {

        }

        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 商品主键
        /// </summary>
        public long ProductId { get; set; }

        /// <summary>
        /// 排序号
        /// </summary>
        public long Sort { get; set; }
        /// <summary>
        /// 行号
        /// </summary>
        public int RowIndex { get; set; }

        /// <summary>
        /// 单位名称
        /// </summary>
        public string StandardName { get; set; }

        /// <summary>
        /// 单位换算关系
        /// </summary>
        public decimal StandardRelation { get; set; }

        /// <summary>
        /// 采购价
        /// </summary>
        public decimal? BuyingPrice { get; set; }

        /// <summary>
        /// 批发价
        /// </summary>
        public decimal? WholesalePrice { get; set; }

        /// <summary>
        /// 配送价
        /// </summary>
        public decimal? DeliveryPrice { get; set; }

        /// <summary>
        /// 零售价
        /// </summary>
        public decimal RetailPrice { get; set; }

        /// <summary>
        /// 会员价
        /// </summary>
        public decimal? MemberPrice { get; set; }

        /// <summary>
        /// 会员价2
        /// </summary>
        public decimal? MemberPrice2 { get; set; }

        /// <summary>
        /// 会员价3
        /// </summary>
        public decimal? MemberPrice3 { get; set; }

        /// <summary>
        /// 会员价4
        /// </summary>
        public decimal? MemberPrice4 { get; set; }

        /// <summary>
        /// 会员价5
        /// </summary>
        public decimal? MemberPrice5 { get; set; }

        /// <summary>
        /// 规格是否隐藏
        /// </summary>
        public bool IsHide { get; set; }

        #region 公共字段

        /// <summary>
        /// 租户ID
        /// </summary>
        public int TenantId { get; set; }

        /// <summary>
        /// 启用 = true
        /// 禁用 = false
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 启用
        /// </summary>
        public void Enable()
        {
            this.IsActive = true;
        }

        /// <summary>
        /// 禁用
        /// </summary>
        public void Disable()
        {
            this.IsActive = false;
        }
        /// <summary>
        /// 条码信息
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<ProductStandardBarCode> BaseProductStandardBarCodeList { get; set; }
        /// <summary>
        /// component
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<ProductComponent> BaseProductComponentList { get; set; }
        /// <summary>
        /// parent
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public ProductParent? BaseProductParent { get; set; }
        #endregion
    }
}